<template>
    <el-dialog :visible.sync="dialogVisible" title="视频提交" width="60%">
        <el-form label-width="100px" :model="form" style="max-width: 460px">
            <el-form-item label="file:"> {{ data }}</el-form-item>
        </el-form>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="close">取消</el-button>
                <el-button type="primary" @click="postData"> 提交 </el-button>
            </span>
        </template>
    </el-dialog>
</template>
<script>
import axios from "axios";
export default {
    data() {
        return {
            dialogVisible: true,
            form: {},
        };
    },
    props: ["data"],
    methods: {
        postData() {
            const data = new FormData();
            data.set("file", this.data);
            axios.post("/api/video/upload", data).finally(() => {
                this.close();
            });
        },
        close() {
            this.$emit("close");
        },
    },
};
</script>


<style scoped>
.dialog-footer button:first-child {
    margin-right: 10px;
}
</style>
